package model;

import java.util.concurrent.atomic.AtomicBoolean;

import painter4ViewHelper.AbstractPainterOwner;
import painter4ViewHelper.Painter;

public class Chair extends AbstractPainterOwner{
	
	private AtomicBoolean isUsed;
	
	public Chair(Painter painter) {
		super(painter);
		isUsed = new AtomicBoolean(false);
	}

	private String name;
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public AtomicBoolean getIsUsed() {
		return isUsed;
	}

	public boolean tryUse() {
		return isUsed.compareAndSet(false, true);
	}
	public boolean tryRelease() {
		return isUsed.compareAndSet(true, false);
	}
}
